<?php
/*
 * Camelot PHP Tools
 *
 * @version 2.0
 * @author Bendsoft
 * @package PHP Tools
 * @subpackage Camelot
 * @license FreeBSD License (www.bendsoft.com/licensing/)
 *
 * Note! 
 * Set up settings.php before using this file
 */

header('Content-Type: text/html; charset=utf-8');
error_reporting(E_ALL);
ini_set('display_errors', '1');

// Load all required files for Camelot PHP Tools
require_once '../loader.php';

/** Methods below * */
function testWcf() {

    try {
        
        ini_set("soap.wsdl_cache_enabled", 0);
        
        $WcfSettingsList = WcfSettingsList::instance();
        $settings = $WcfSettingsList->getSettings('SharePointConnection1');
        
        $wsdloptions = array(
            'soap_version' => $settings->wsdl_soap_version,
            'exceptions' => $settings->wsdl_exceptions,
            'trace' => $settings->wsdl_trace
        );

        $client = new SoapClient($settings->wsdl_address, $wsdloptions);
        
        $serverTime = $client->GetServerTime()->GetServerTimeResult;
        echo "<h2>Current server time: $serverTime</h2>";
        
        pr($client->__getFunctions());
        pr($client->__getTypes());
    } catch (Exception $exc) {
        echo "<h2>Method unsuccessful :(</h2><ul><ol>Did you set up settings.php?</ol><ol>Check your SQL syntax</ol><ol>Check the rest of your argument array</ol></ul>";
        echo $exc->getTraceAsString();
    }
    
}
?>

<html>
    <head>
        <title>WCF test page</title>
    </head>

    <body>

<?php
testWcf();
?>

    </body>

</html>